<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src='./js/jquery-3.6.0.min.js'></script>
    <script src="./js/getUrlParam.js"></script>
    <script src='./js/url.js'></script>
    <script src='./js/base.js'></script>
    
</head>
<body>
    <table name='tb'>
        <tr>
            <td>ID</td>
            <td>
                <input type="text" value="0" id='id'>
            </td>
        </tr>
        <tr>
            <td>标题</td>
            <td>
                <input type="text" value="" id='title'>
            </td>
        </tr>
        <tr>
            <td>摘要</td>
            <td>
                <input type="text" value="" id='abstract'>
            </td>
        </tr>
        <tr>
            <td>内容</td>
            <td>
                <input type="text" value="" id='content'>
            </td>
        </tr>
        <tr>
            <td>分类</td>
            <td>
                <input type="text" value="" id='classify'>
            </td>
        </tr>
        <tr>
            <td>作者</td>
            <td>
                <input type="text" value="" id='author'>
            </td>
        </tr>
    </table>
    <input type="button" value="修改" onclick="fn_alert()" id='alert'>
    <input type="button" value="返回" onclick="fn_return()">
</body>
<script>
    let id = getUrlParam('id'); 
    console.log(id);
    if (id) {
        console.log("ss");
        $.ajax({
            url:url+'/true',
            type:'post',
            data:{id},
            success:(res)=>{
                console.log(res);
                let ID = $("#id").val(res.data[0].id)
                let title = $('#title').val(res.data[0].title);
                let abstract = $('#abstract').val(res.data[0].abstract);
                let content = $('#content').val(res.data[0].content);
                let classify = $('#classify').val(res.data[0].classify);
                let author = $('#author').val(res.data[0].author); 
                }
            });
        }
        else{
            $('#alert').val('添加');
        }
       
   
</script>
</html>